package com.sap.tpcd.policybuilder.policymodel;

/**
 * @author I068988
 * @version 1.0
 * @created 30-sept.-2011 14:12:33
 */
public class AlgorithmeSuite extends PolicyElement {

	private String confidentiality;
	private String integrity;
	private String name;

	public AlgorithmeSuite() {
		super();
	}

	public AlgorithmeSuite(String confidentiality, String integrity, String name) {
		super();
		this.confidentiality = confidentiality;
		this.integrity = integrity;
		this.name = name;
	}

	/*
	 * To verify if the policy element is mapped to a system element or not .
	 * 
	 * @see com.sap.tpcd.policyhandler.PolicyElement#isMapped()
	 */
	public boolean isMapped() {
		if (this.m_SystemElements == null)
			return false;
		return true;
	}

	/**
	 * @return the confidentiality
	 */
	public String getConfidentiality() {
		return confidentiality;
	}

	/**
	 * @param confidentiality
	 *            the confidentiality to set
	 */
	public void setConfidentiality(String confidentiality) {
		this.confidentiality = confidentiality;
	}

	/**
	 * @return the integrity
	 */
	public String getIntegrity() {
		return integrity;
	}

	/**
	 * @param integrity
	 *            the integrity to set
	 */
	public void setIntegrity(String integrity) {
		this.integrity = integrity;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((confidentiality == null) ? 0 : confidentiality.hashCode());
		result = prime * result
				+ ((integrity == null) ? 0 : integrity.hashCode());
		result = prime * result + ((name == null) ? 0 : name.hashCode());
		return result;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!(obj instanceof AlgorithmeSuite)) {
			return false;
		}
		AlgorithmeSuite other = (AlgorithmeSuite) obj;
		if (confidentiality == null) {
			if (other.confidentiality != null) {
				return false;
			}
		} else if (!confidentiality.equals(other.confidentiality)) {
			return false;
		}
		if (integrity == null) {
			if (other.integrity != null) {
				return false;
			}
		} else if (!integrity.equals(other.integrity)) {
			return false;
		}
		if (name == null) {
			if (other.name != null) {
				return false;
			}
		} else if (!name.equals(other.name)) {
			return false;
		}
		return true;
	}

}